package com.gitee.linmt;

import com.gitee.linmt.entity.Result;
import com.gitee.linmt.exception.ServiceException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author <a href="mailto:lin-mt@outlook.com">lin-mt</a>
 */
@RestController
@RequestMapping("/msg")
public class MsgController {
    
    @GetMapping("/success")
    public Result<Object> success() {
        return Result.successMsg("000001");
    }
    
    @GetMapping("/warning")
    public Result<Object> warning() {
        return Result.warningMsg("000001");
    }
    
    @GetMapping("/failure")
    public Result<Object> failure() {
        return Result.failureMsg("000001");
    }
    
    @GetMapping("/exception")
    public Result<Object> exception() {
        throw new ServiceException("000001");
    }
    
    @GetMapping("/param")
    public Result<Object> param() {
        return Result.success().setMessage("这是成功的参数：{}").setMsgParam("执行成功");
    }
}
